/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.acionista.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "cliente_participacao", catalog = "acionista", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "ClienteParticipacao.findAll", query = "SELECT c FROM ClienteParticipacao c")})
public class ClienteParticipacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ClienteParticipacaoPK clienteParticipacaoPK;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "perc_partic", precision = 18, scale = 4)
    private BigDecimal percPartic;
    @JoinColumn(name = "id_cliente", referencedColumnName = "id_cliente", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Cliente cliente;

    public ClienteParticipacao() {
    }

    public ClienteParticipacao(ClienteParticipacaoPK clienteParticipacaoPK) {
        this.clienteParticipacaoPK = clienteParticipacaoPK;
    }

    public ClienteParticipacao(int idCliente, Date datPartic) {
        this.clienteParticipacaoPK = new ClienteParticipacaoPK(idCliente, datPartic);
    }

    public ClienteParticipacaoPK getClienteParticipacaoPK() {
        return clienteParticipacaoPK;
    }

    public void setClienteParticipacaoPK(ClienteParticipacaoPK clienteParticipacaoPK) {
        this.clienteParticipacaoPK = clienteParticipacaoPK;
    }

    public BigDecimal getPercPartic() {
        return percPartic;
    }

    public void setPercPartic(BigDecimal percPartic) {
        this.percPartic = percPartic;
    }

    public Cliente getCliente() {
        return cliente;
    }

    public void setCliente(Cliente cliente) {
        this.cliente = cliente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (clienteParticipacaoPK != null ? clienteParticipacaoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClienteParticipacao)) {
            return false;
        }
        ClienteParticipacao other = (ClienteParticipacao) object;
        if ((this.clienteParticipacaoPK == null && other.clienteParticipacaoPK != null) || (this.clienteParticipacaoPK != null && !this.clienteParticipacaoPK.equals(other.clienteParticipacaoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.acionista.entity.ClienteParticipacao[ clienteParticipacaoPK=" + clienteParticipacaoPK + " ]";
    }
    
}
